package br.inf.prismasoft.academix.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * Professor generated by hbm2java
 */
@Entity
@Table(name = "PROFESSOR", schema = "ACADEMIX")
public class Professor implements java.io.Serializable {

	private static final long serialVersionUID = 1252321359526497291L;
	private Integer idtProfessor;
	private Endereco endereco;
	private String numRm;
	private String nomProfessor;
	private int numEndereco;
	private String desComplemento;
	private Set<GradeHorariaItem> gradeHorariaItems = new HashSet<GradeHorariaItem>(
			0);

	public Professor() {
	}

	public Professor(Endereco endereco, String numRm, String nomProfessor,
			int numEndereco) {
		this.endereco = endereco;
		this.numRm = numRm;
		this.nomProfessor = nomProfessor;
		this.numEndereco = numEndereco;
	}

	public Professor(Endereco endereco, String numRm, String nomProfessor,
			int numEndereco, String desComplemento,
			Set<GradeHorariaItem> gradeHorariaItems) {
		this.endereco = endereco;
		this.numRm = numRm;
		this.nomProfessor = nomProfessor;
		this.numEndereco = numEndereco;
		this.desComplemento = desComplemento;
		this.gradeHorariaItems = gradeHorariaItems;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "idt_professor", unique = true, nullable = false)
	public Integer getIdtProfessor() {
		return this.idtProfessor;
	}

	public void setIdtProfessor(Integer idtProfessor) {
		this.idtProfessor = idtProfessor;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ind_endereco", nullable = false)
	@NotNull
	public Endereco getEndereco() {
		return this.endereco;
	}

	public void setEndereco(Endereco endereco) {
		this.endereco = endereco;
	}

	@Column(name = "num_rm", nullable = false, length = 6)
	@NotNull
	@Length(max = 6)
	public String getNumRm() {
		return this.numRm;
	}

	public void setNumRm(String numRm) {
		this.numRm = numRm;
	}

	@Column(name = "nom_professor", nullable = false, length = 50)
	@NotNull
	@Length(max = 50)
	public String getNomProfessor() {
		return this.nomProfessor;
	}

	public void setNomProfessor(String nomProfessor) {
		this.nomProfessor = nomProfessor;
	}

	@Column(name = "num_endereco", nullable = false)
	@NotNull
	public int getNumEndereco() {
		return this.numEndereco;
	}

	public void setNumEndereco(int numEndereco) {
		this.numEndereco = numEndereco;
	}

	@Column(name = "des_complemento", length = 20)
	@Length(max = 20)
	public String getDesComplemento() {
		return this.desComplemento;
	}

	public void setDesComplemento(String desComplemento) {
		this.desComplemento = desComplemento;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "professor")
	public Set<GradeHorariaItem> getGradeHorariaItems() {
		return this.gradeHorariaItems;
	}

	public void setGradeHorariaItems(Set<GradeHorariaItem> gradeHorariaItems) {
		this.gradeHorariaItems = gradeHorariaItems;
	}

}
